examples: Use GtkDrawingArea::resize
authorMatthias Clasen <mclasen@redhat.com>
Tue, 5 May 2020 15:54:47 +0000 (11:54 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 6 May 2020 18:27:45 +0000 (14:27 -0400)
This signal is a replacement for this (ab)use
of the ::size-allocate signal, which is going away.

examples/drawing.c

index be45149e5c229d40d6c35101145cde3181a7c605..4986f695397547aff8cb2cb3a990c2d8a0b82627 100644 (file)
@@ -18,10 +18,10 @@ clear_surface (void)
 
 /* Create a new surface of the appropriate size to store our scribbles */
 static void
-size_allocate_cb (GtkWidget     *widget,
-                  GtkAllocation *alloc,
-                  int            baseline,
-                  gpointer       data)
+resize_cb (GtkWidget *widget,
+           int        width,
+           int        height,
+           gpointer   data)
 {
   if (surface)
     {
@@ -153,8 +153,7 @@ activate (GtkApplication *app,
 
   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area), draw_cb, NULL, NULL);
 
-  g_signal_connect_after (drawing_area, "size-allocate",
-                          G_CALLBACK (size_allocate_cb), NULL);
+  g_signal_connect_after (drawing_area, "resize", G_CALLBACK (resize_cb), NULL);
 
   drag = gtk_gesture_drag_new ();
   gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);